<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@page import="org.apache.struts2.json.JSONUtil"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@taglib uri="/struts-tags" prefix="s"%>
<%@taglib prefix="d" uri="/doone-comm-ui-tags"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title></title>
<link type="text/css" href="<%=path%>/manage/css/layout.css"
	rel="stylesheet" />
<link type="text/css" href="<%=path%>/manage/css/push_style.css"
	rel="stylesheet" />
<link type="text/css"
	href="<%=path%>/manage/page/user/css/users_style.css" rel="stylesheet" />
<link rel="stylesheet" type="text/css"
	href="<%=path%>/manage/css/Tooltip.css" />
<link type="text/css"
	href="<%=path%>/manage/css/jquery.dropdownchecklist.css"
	rel="stylesheet" />
<link type="text/css" href="<%=path%>/manage/css/jquery.pagination.css"
	rel="stylesheet" />
<script type="text/javascript"
	src="<%=path%>/manage/js/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="<%=path%>/manage/js/jquery_form.js"></script>
<script type="text/javascript" src="<%=path%>/manage/js/easyTooltip.js"></script>
<script type="text/javascript"
	src="<%=path%>/manage/js/jquery.wysiwyg.js"></script>
<script type="text/javascript" src="<%=path%>/manage/js/hoverIntent.js"></script>
<script type="text/javascript" src="<%=path%>/manage/js/superfish.js"></script>
<script type="text/javascript" src="<%=path%>/manage/js/custom.js"></script>
<script type="text/javascript" src="<%=path%>/manage/js/Tooltip.js"></script>
<script type="text/javascript" src="<%=path%>/manage/js/errorTip.js"></script>
<script type="text/javascript"
	src="<%=path%>/manage/js/jquery.validate.min.js"></script>
<script type="text/javascript"
	src="<%=path%>/manage/js/jquery.validate.methods.min.js"></script>
<script type="text/javascript"
	src="<%=path%>/manage/js/jquery.validate.defaults.js"></script>
<script type="text/javascript"
	src="<%=path%>/manage/js/jquery.dropdownchecklist.core.js"></script>
<script type="text/javascript"
	src="<%=path%>/manage/js/jquery.dropdownchecklist.js"></script>
<script type="text/javascript"
	src="<%=path%>/manage/js/jquery.pagination.js"></script>
<script type="text/javascript"
	src="<%=path%>/manage/js/jquery-ui-1.8.11.custom.min.js"></script>
<script type="text/javascript"
	src="<%=path%>/manage/js/jquery.blockUI.js"></script>
<script type="text/javascript"
	src="<%=path%>/manage/js/My97DatePicker/WdatePicker.js"></script>
<!-- End of Libraries -->
<script type="text/javascript" src="<%=path%>/manage/js/push/push.js">
	
</script>
<style type="text/css">
.editInfo li {
	margin: 5 0;
}

.editInfo li input,textarea {
	margin-left: 0px;
}

.btnNewInfo {
	width: 80px;
	height: 35px;
	float: left;
	margin: 10px 5px 0 0;
}

.btnNewInfo input {
	width: 60px;
}

.btnNewInfo img {
	width: 16px;
	height: 16px;
	float: right;
	top: -35px;
	left: -12px;
	left: -10px\9;
	position: relative;
}

.deleteInfoBtn {
	width: 16px;
	height: 16px;
	float: right;
	top: 0px;
	left: 340px;
	top: 15px\9;
	left: 334px\9;
	position: absolute;
}

.uploadImgInfo {
	position: absolute;
	margin-top: -8px;
	width: 16px;
	height: 16px;
	margin-left: -10px;
}

.iconDeleteBtn {
	width: 16px;
	height: 16px;
	float: right;
	top: -1px;
	left: 90px;
	position: absolute;
}

.content {
	padding-top: 10px;
	position: relative;
	z-index: 1;
}

.expand {
	display: none;
}

.expand a.yc {
	background:
		url("${pageContext.request.contextPath}/manage/images/btn_yc.jpg");
	display: block;
	width: 86px;
	height: 24px;
	float: right;
	margin-right: 32px;
}

.expand a.yc:hover {
	background:
		url("${pageContext.request.contextPath}/manage/images/btn_yc_hover.jpg");
}

.expand a.zk {
	background:
		url("${pageContext.request.contextPath}/manage/images/btn_zk.jpg");
	display: block;
	width: 86px;
	height: 24px;
	float: right;
	margin-right: 32px;
}

.expand a.zk:hover {
	background:
		url("${pageContext.request.contextPath}/manage/images/btn_zk_hover.jpg");
}

.searchField li {
	width: 200px;
}

.searchField li span {
	text-align: left;
}

.searchField span.zd_title {
	display: inline-block;
	width: 5em;
	height: 24px;
	line-height: 24px;
	text-align: right;
}

input.noborder {
	border: 0px solid #999999;
}
</style>
<script type="text/javascript">
	var path = "${pageContext.request.contextPath}";
	var showUserList = "${showUserList}";
	var serverUrl = "${serverUrl}";
	var body = ${pnsMessages.body ne null?pnsMessages.body : '[]'};
	var toDo="${pnsMessages.id eq null ? 'add' : 'edit'}";
</script>
</head>
<body>
	<p class="sitemap">当前位置：内容管理 > 推送消息新增</p>
	<h1>推送消息编辑</h1>
	<div>
		<div id="tabs">
			<ul>
				<li><a href="#tabs-1">推送消息编辑</a></li>
			</ul>
			<c:if test="${pnsMessages.flag ne 0 }">
				<c:if test="${pnsMessages.id  eq null}">
					<!-- 检索 -->
					<div class="searchbox">
						<form name="searchForm" id="searchForm" method="post"
							action="${pageContext.request.contextPath }/push/addPushMessage.action"
							style="margin: 0 10px 10px 10px;">
							<ul class="searchField">
								<li><span class="zd_title">用户系统:</span> <select
									class="text01" name="condition.deviceType">
										<option value="">-全部-</option>
										<option value="android"
											<c:if test="${condition.deviceType eq 'android' }">selected="selected"</c:if>>
											Android</option>
										<option value="ios"
											<c:if test="${condition.deviceType eq 'ios' }">selected="selected"</c:if>>
											IOS</option>
								</select></li>
								<li><span class="zd_title">用户分组:</span> <select
									id="userType" class="text01" name="condition.userType">
										<option value="">-全部-</option>
										<option value="NORMAL"
											<c:if test="${condition.userType eq 'NORMAL' }">selected="selected"</c:if>>
											-会员-</option>
										<option value="NOT_VERIF"
											<c:if test="${condition.userType eq 'NOT_VERIF' }">selected="selected"</c:if>>
											-未验证-</option>
										<option value="ANON"
											<c:if test="${condition.userType eq 'ANON' }">selected="selected"</c:if>>
											-匿名-</option>
								</select></li>
								<li><span class="zd_title">社交类型:</span> <select
									id="provider" class="text01" name="condition.provider">
										<option value="">-全部-</option>
										<option value="T_SINA"
											<c:if test="${condition.provider eq 'T_SINA' }">selected="selected"</c:if>>
											新浪</option>
										<option value="T_TENCENT"
											<c:if test="${condition.provider eq 'T_TENCENT' }">selected="selected"</c:if>>
											腾讯</option>
								</select></li>
								<li style="width: 300px"><span class="zd_title"
									style="vertical-align: top">用户机型:</span> <select
									name="condition.deviceModel" style="width: 210px;"
									multiple="multiple">
										<option value="ALL"
											<c:forEach var="choseModel" items="${condition.deviceModel }" >
										 <c:if test="${choseModel eq 'ALL'}">selected="true"</c:if>
										</c:forEach>>-全部-</option>
										<c:forEach var="model" items="${deviceModels }">
											<option value="${model}"
												<c:forEach var="choseModel" items="${condition.deviceModel }" >
										 <c:if test="${choseModel eq model}">selected="true"</c:if>
										</c:forEach>>${model}</option>
										</c:forEach>
								</select></li>
								<li><span class="zd_title">关键字:</span> <input type="text"
									class="text01" name="condition.userName"
									value="${condition.userName ne null&&condition.userName ne '' ? condition.userName : '昵称/用户名' }">
								</li>
							</ul>
							<div class="clear"></div>
							<div style="margin-right: 110px;">
								<input type="button" id="restBtn" value="重置"
									style="float: right; margin-right: 10px;"> <input
									type="submit" id="searchBtn" value="检索" style="float: right">
								<div class="clear"></div>
							</div>
						</form>
					</div>
					<c:if test="${pnsMessages.id  eq null}">
						<div class="expand">
							<a href="#" class="yc" id="expand_btn"></a>
							<div style="clear: both;"></div>
						</div>
					</c:if>
				</c:if>
			</c:if>
			<input type="hidden" value="${totalCount }" name="initTotalCount" />
			<div class="user_list"></div>
			<div id="pagination" class="pagination" style="display: none;"></div>
			<hr>
			<form id="pnsAddForm"
				action="${pageContext.request.contextPath }/push/${pnsMessages.id  eq null ? 'addMessage.action' : 'doEditMessage.action' }"
				method="post" onsubmit="return sub(this);">
				<table id="pnsAdd" cellspacing="0" cellpadding="0" border="0"
					class="fullwidth" style="display: none;">
					<c:if test="${pnsMessages.id  ne null}">
						<input type="hidden" name="pnsMessages.id"
							value="${pnsMessages.id }" />
					</c:if>
					<tbody>
						<tr class="odd">
							<td width="60" valign="top" align="right">标题：</td>
							<td><input type="text" maxlength="25"
								name="pnsMessages.title" value="${pnsMessages.title }" size="47"
								<c:if test="${pnsMessages.flag eq 0 }">readonly="readonly"</c:if>>
								<span>(最大长度25)</span></td>
						</tr>
						<tr class="odd">
							<td width="60" valign="top" align="right">图标：</td>
							<td><c:if test="${pnsMessages.flag ne 0 }">
									<input type='button' id="iconUploadBtn" value='上传图片' />
								</c:if> <br> <input type="hidden" name="pnsMessages.icon"
								value="${pnsMessages.icon }">
								<div id="iconDiv">
									<c:if test="${pnsMessages.icon ne null}">
										<div style="position: relative; padding-top: 5px;"
											id="iconMsg">
											<img src='${serverUrl }${pnsMessages.icon }' width='100px'
												id="iconMsgImg" />
											<c:if test="${pnsMessages.flag ne 0 }">
												<img
													src="${pageContext.request.contextPath }/images/delete.png"
													class="iconDeleteBtn" id="iconDeleteImg" />
											</c:if>
										</div>
									</c:if>
								</div></td>
						</tr>
						<tr class="odd">
							<td valign="top" align="right">简介：</td>
							<td><textarea style="float: left;" rows="2" cols="30"
									name="pnsMessages.summary"
									<c:if test="${pnsMessages.flag eq 0 }">readonly="readonly"</c:if>>${pnsMessages.summary }</textarea>
								<span style="float: left;">(最大长度50)</span></td>
						</tr>
						<tr class="odd">
							<td valign="top" align="right">时间：</td>
							<td><input type="text" name="pnsMessages.startTime"
								id="startTime"
								<c:if test="${pnsMessages.flag ne 0 }">onfocus="WdatePicker({dateFmt:'yyyy-M-d H:mm:ss',minDate:'%y-%M-%d %H:{%m+1}:%s',maxDate:'#F{$dp.$D(expireTime)}',onpicked:function(){$dp.$('expireTime').focus();}})"</c:if>
								readonly="readonly"
								value="<fmt:formatDate value="${pnsMessages.startTime}" pattern="yyyy-MM-dd HH:mm:ss"/>">
								<input type="text" name="pnsMessages.expireTime" id="expireTime"
								<c:if test="${pnsMessages.flag ne 0 }">onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',minDate:'#F{$dp.$D(startTime,{m:1});}'})"</c:if>
								readonly="readonly"
								value='<fmt:formatDate value="${pnsMessages.expireTime }" pattern="yyyy-MM-dd HH:mm:ss"/>'>
							</td>
						</tr>
						<c:if test="${pnsMessages.flag ne 0 }">
							<tr class="odd">
								<td></td>
								<td><a href="javascript:void(0);" class="icon_tjwb">添加文本</a>
									<a href="javascript:void(0);" class="icon_tjtp">添加图片</a> <a
									href="javascript:void(0);" class="icon_tjwblj">添加外部链接</a></td>
							</tr>
						</c:if>
						<tr class="odd">
							<td valign="top" align="right">内容：</td>
							<td>
								<div class="contentAll">
									<c:if test="${pnsMessages.bodyDtos ne null }">
										<c:forEach var="body" items="${pnsMessages.bodyDtos }"
											varStatus="index">
											<c:set property="request" var="count"
												value="${index.count-1 }"></c:set>
											<c:if test="${body.type eq 'TXT' }">
												<div class="content" id="textTemplate">
													<input type='hidden' name='bodyDtos[${count}].type'
														value="TXT" />
													<c:if test="${pnsMessages.flag ne 0 }">
														<img src="<%=path%>/images/delete.png"
															class="deleteInfoBtn" />
													</c:if>
													<textarea name="bodyDtos[${count}].value"
														readonly="readonly">${body.value }</textarea>
												</div>
											</c:if>
											<c:if test="${body.type eq 'IMAGE' }">
												<div class="content" id="imgTemplate">
													<input type='hidden' name='bodyDtos[${count}].type'
														value='IMAGE'> <img
														src='${serverUrl }${body.value }' width='350px'
														style="cursor: pointer;" />
													<c:if test="${pnsMessages.flag ne 0 }">
														<img src="<%=path%>/images/delete.png"
															class="uploadImgInfo" />
														<input type='hidden' name='bodyDtos[${count}].value'
															value="${body.value }" />
													</c:if>
												</div>
											</c:if>
											<c:if test="${body.type eq 'URL' }">
												<div class="content" id="urlTemplate">
													外部链接地址: <input type="hidden" name='bodyDtos[${count}].type'
														value="URL"> <input type="text"
														name='bodyDtos[${count}].value' value="${body.value }"
														readonly="readonly">
													<c:if test="${pnsMessages.flag ne 0 }">
														<input type='button' class="delUrl" value='删除'>
													</c:if>
												</div>
											</c:if>
										</c:forEach>
									</c:if>
								</div>
							</td>
						</tr>
						<tr>
							<td><c:if test="${pnsMessages.flag ne 0 }">
									<c:if test="${pnsMessages.id  eq null}">
										<input type="submit" value="发送" id="send"
											style="cursor: pointer;">
									</c:if>
									<c:if test="${pnsMessages.id  ne null}">
										<input type="submit" value="确定" id="send"
											style="cursor: pointer;">
									</c:if>
								</c:if> <c:if test="${pnsMessages.flag eq 0 }">
									<input type="submit" value="返回" onclick="window.history.back()"
										style="cursor: pointer;">
								</c:if></td>
						</tr>
					</tbody>
				</table>
			</form>
		</div>
	</div>
</body>
</html>
